package sketch.shape.geom;

import java.awt.Graphics2D;

import sketch.shape.Shape;
import sketch.shape.geom.prim.Point;

public class Circle extends Shape {

	private Point center;

	private double radius;

	public Circle(Point center, double radius) {
		this.center = center;
		this.radius = radius;
	}

	public Circle() {
		this(new Point(), 0);
	}

	public Point getCenter() {
		return center.clone();
	}

	public void setCenter(Point center) {
		this.center = center;
	}

	public double getX() {
		return getCenter().getX();
	}

	public double getY() {
		return getCenter().getY();
	}

	public double getRadius() {
		return radius;
	}

	public void setRadius(double radius) {
		this.radius = radius;
	}

	public void drawComponent(Graphics2D g2) {
		super.drawComponent(g2);

//		g2.drawOval( (int)(getX() - getRadius()),
//					 (int)(getY() - getRadius()),
//					 (int)(2 * getRadius()),
//					 (int)(2 * getRadius()));
		g2.draw(getBound(0));
	}

	public java.awt.Shape getBound(double GAP) {
		double x = getX() - GAP;
		double y = getY() - GAP;
		double width = getRadius() + 2 * GAP;
		double height = getRadius() + 2 * GAP;

		return new java.awt.geom.Ellipse2D.Double(x, y, width, height);
	}

}
